<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Title</title>
    </head>
    <body>

        <div id="app">
            <h2>日常英雄列表</h2>
            <input type="text" v-model="work" class="input" @keyup.enter="addWork">
            <input type="button" value="添加" @click = "addWork">
            <div>
                <li v-for="(i,index) in workArr">序号 {{index+1}} : {{i}}
                    <input type="button" value="删除" @click="workArr.splice(index,1)">
                </li>
            </div>

        </div>
        <script src="../js/vue.js"></script>
        <script>
            var app = new Vue({
                el:"#app",
                data: {
                    work:"",
                    workArr:[]
                },
                methods: {
                    addWork(){
                        if (this.work!=""){
                            this.workArr.push(this.work);
                            this.work = "";
                        }
                    }
                }
            })
        </script>
    </body>
</html>